package com.lyc.scanner;
import java.util.Scanner;

public class Demo05 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double sum = 0;
        int m = 0;
        System.out.println("请输入数字:");
        while (scanner.hasNextDouble()){
            double x = scanner.nextDouble();
            ++m;
            sum = sum + x;
            System.out.println("你输入了第"+m+"个数据，然后当前结果sum="+sum);

        }
        System.out.println("你一共输入了"+m+"个数据，然后结果sum="+sum);
        System.out.println("平均值是"+(sum/m));
        scanner.close();
    }
}
